import { createRouter, createWebHashHistory } from 'vue-router'


const router = createRouter({
    history: createWebHashHistory(),
    routes: [
        {
            path: '/',
            redirect: '/home',  
        },
        {
            path: '/home',
            name: 'Home',
            meta: {
                title: '首页'
            },
            component: () => import('@/views/Home/index.vue') 
        },


    ]
})

router.beforeEach((to, from, next) => {
    if (to.meta.title) {
        document.title = to.meta.title + "-" + import.meta.env.VITE_APP_TITLE;//获取相应路由信息里面的title
    }
    next()
});

router.afterEach((to, from) => {

});

export default router
